import { Component } from '@angular/core';
import { NavbarService } from './navbar.service';

@Component({
    moduleId: module.id,
    selector: 'navbar',
    templateUrl: 'navbar.component.html',
    styleUrls: ['navbar.component.css']
})
export class NavbarComponent {
    private showAddBtn: boolean;
    constructor() {
        NavbarService.Current.NavigateChangeEvent = () => {
            if (NavbarService.Current.OnAddData) this.showAddBtn = true;
            else this.showAddBtn = false;
        }
    }
    goback() {
        if (NavbarService.Current.OnGoback) NavbarService.Current.OnGoback();
        else window.history.back();
    }

    addData() {
        if (NavbarService.Current.OnAddData) NavbarService.Current.OnAddData();
    }
}